package com.example.youhuo.utils

import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Retrofit
import retrofit2.adapter.rxjava2.RxJava2CallAdapterFactory
import retrofit2.converter.gson.GsonConverterFactory

class LjlRetrofit_Utils private constructor(){
    companion object{
        val incase by lazy(mode = LazyThreadSafetyMode.SYNCHRONIZED){
            LjlRetrofit_Utils()
        }
    }

    private lateinit var retrofit: Retrofit

    fun creatRetrofit(): Retrofit{
        retrofit = Retrofit.Builder()
            .baseUrl("http://iwenwiki.com/api/yoho/")
            .addCallAdapterFactory(RxJava2CallAdapterFactory.create())
            .addConverterFactory(GsonConverterFactory.create())
            .client(OkHttpClient.Builder().addInterceptor(HttpLoggingInterceptor().setLevel(HttpLoggingInterceptor.Level.BODY)).build())
            .build()
        return retrofit
    }


}